import time

def bub(n):
    s=True
    while s:
        s=False
        for i in range(len(n) - 1):
            if n[i] > n[i + 1]:
                n[i], n[i + 1] = n[i + 1], n[i]
                s= True

def r(name):
    file = open(name, 'r')
    data = file.readlines()
    return data

m1 = r("m1_sorted.txt")
m2 = r("m2_reverse.txt")
m3 = r("m3_shuffle.txt")

start = time.time()
b(m1)
finish = time.time()
print("m1_sorted",round((finish-start)*1000),"milliseconds")

start = time.time()
b(m2)
finish= time.time()
print("m2_reverse",round((finish-start)*1000),"milliseconds")

t_start = time.time()
bubble_sort(m3)
t_finish = time.time()
print("m3_shuffle",round((t_finish-t_start)*1000),"milliseconds")
